FROM hub.atomgit.com/amd64/node:18-slim AS build
RUN npm config set registry https://registry.npmmirror.com

COPY . /usr/src/app
WORKDIR /usr/src/app
RUN npm install pnpm -g
RUN pnpm install --no-frozen-lockfile

RUN pnpm build

FROM hub.atomgit.com/amd64/nginx:1.25.2-alpine as admin
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
COPY --from=build /usr/src/app/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
